﻿namespace PhotobucketNet
{
    using System;
    using System.Xml;

    public class UserContact
    {
        private string _email = string.Empty;
        private string _firstName = string.Empty;
        private string _lastName = string.Empty;

        private UserContact(string first, string last, string email)
        {
            this._firstName = first;
            this._lastName = last;
            this._email = email;
        }

        internal static UserContact CreateFromXmlNode(XmlNode contactNode)
        {
            XmlNode node = contactNode.SelectSingleNode("descendant::first");
            string first = (node == null) ? string.Empty : node.InnerText;
            XmlNode node2 = contactNode.SelectSingleNode("descendant::last");
            string last = (node2 == null) ? string.Empty : node2.InnerText;
            XmlNode node3 = contactNode.SelectSingleNode("descendant::email");
            return new UserContact(first, last, (node3 == null) ? string.Empty : node3.InnerText);
        }

        public string Email
        {
            get
            {
                return this._email;
            }
        }

        public string FirstName
        {
            get
            {
                return this._firstName;
            }
        }

        public string LastName
        {
            get
            {
                return this._lastName;
            }
        }
    }
}

